<?php
namespace PsiFramework\Applications\AlloMediaAdmin\Classes\Actions;

use PsiFramework\Classes\Util\Parameters\Action\ActionParameters;

import("Applications.AlloMediaPortal.Classes.Actions.AlloMediaUserAction");
import("Classes.Util.HTTP.AuthenticationManager");
import("Classes.Factory.DAOFactory");

use \PsiFramework\Applications\AlloMediaPortal\Classes\Actions\AlloMediaUserAction;
use \PsiFramework\Classes\Util\HTTP\AuthenticationManager;
use \PsiFramework\Classes\Util\Parameters\Action\ActionParameters;
use \PsiFramework\Classes\Factory\DAOFactory;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'action de l'index
 *
 * @package Actions.Pages
 */
class AlloMediaEditProfile extends AlloMediaUserAction
{

    public function __construct(ActionParameters $actionParameters)
    {
        parent::__construct($actionParameters);
    }

    /**
     * The main function of the method which is called every time
     * an action is created by the front controller.
     *
     */
    public function execute()
    {
        parent::execute();

        $formId = $this->_request->getParameter('form_id');
        $form = null ;

        if (!isNullOrEmptyString($formId)) {
            $formDao = DAOFactory::getDAO('Form');
            $form = $formDao->retrieveByPk($formId);
        }

        $this->_response->setAttribute("form", $form);

        if (is_null($form)) {
            $this->findForward("entry");
        } else {
            $this->findForward("theme");
        }
    }
}
